#include "head.h"

// 主线程等待子线程有序退出
int __exit__(pool_t* pool)
{
    pthread_mutex_lock(&pool->mutex);
    pool->alive = false;
    pthread_mutex_unlock(&pool->mutex);

    pthread_cond_broadcast(&pool->cond);

    for(int i = 0; i < POOL_NUM; ++i)
        pthread_join(pool->thread_pid[i], NULL);

    pthread_exit(NULL);

    return 0;
}